<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>js练习</title>
    <style>
        *{
            margin:0;
            padding: 0;
            box-sizing: border-box;
        }
        .box{
            margin:0 50%;
            height:200px;
            width:150px;
            background-color: antiquewhite;
            text-align: center;
            position: relative;
            left:-75px;
        }
        .container{
            top:25px;
        }
        div{
            margin: 15px auto;
            padding: 10px auto;
            text-align: center;
            position: relative;
        }
        .btn-double{
            height:40px;
            width:150px;
            text-align: center;
            margin: 10px auto;
            position: relative;
        }
        button{
            padding: 5px;
            margin: 10px 10px;
            height: 40px;
        }
        button:first-child{
            float: left;
        }
        button:last-child{
            float: right;
        }

    </style>
  </head>
  <body>
    <div class="box">
      <div class="container">

        <div>商品:web前端</div>
      <div>现价:100rmb</div>

      <div class="btn-double">
           <div>
              <button>取消</button>
              <button>支付</button>
            </div>
      </div>
      
      </div>
    </div>
    <script>
        document.getElementsByTagName('button')[1].onclick = function(){
            var re = window.confirm('请问您确定要支付吗？');
            if(re){
                location.href = "./index2.html";
            }
        }
    </script>
  </body>
</html>